# -*- coding:utf-8 -*-

from com.mat.rpa.utils.globalConstants import GlobalConstants
from com.mat.rpa.views.workWindow.leftPanel.directiveTree import treeItem
from . import listOperationConstants

class ListOperationSubDirectiveTree(treeItem.TreeItemWithID):
    def __init__(self, parent):
        super(ListOperationSubDirectiveTree, self).__init__(parent)
        self.createListOperationTreeNode()

    def createListOperationTreeNode(self):
        self.nodeType = GlobalConstants.treeBranchType
        self.directiveType = "listOperation"
        self.setText(0,"列表操作")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.creatingNewListDirective, "新建列表")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.clearingListDirective, "清空列表")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.appendingOneItemToListDirective, "列表添加一项")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.changingItemValueAtSpecificIndexDirective, "修改列表指定位置项的值")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.gettingSpecificItemDirective, "获取列表指定位置项")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.gettingIndexOfSpecificItemDirective, "获取列表指定项的位置")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.gettingLengthOfListDirective, "获取列表长度")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.deletingOneItemFromListDirective, "删除列表一项")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.filteringMultiItemsFromListDirective, "过滤列表中的多项")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.sortingListDirective, "列表排序")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.sortingListAtRandomDirective, "列表随机排序")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.mergingListsDirective, "合并列表")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.reversingListDirective, "翻转列表")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.removingDuplicateInListDirective, "列表去重")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, listOperationConstants.ListOperationConstants.gettingSameItemsInTwoListsDirective, "获取两个列表相同项")
